package com.sg.service.base.app.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.dto.base.app.req.*;
import com.sg.entity.OmsVirtualOrgMember;
import com.sg.service.base.app.MOmsVirtualOrgMemberService;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.dal.mapper.mbg.OmsVirtualOrgMemberMapper;
import com.wicket.okrframework.common.annotations.BanAuto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @since 2022/1/19 15:39
 */
@Service
public class MOmsVirtualOrgMemberServiceImpl
        extends ServiceImpl<OmsVirtualOrgMemberMapper, OmsVirtualOrgMember>
        implements MOmsVirtualOrgMemberService {

    @Autowired
    OmsVirtualOrgMemberMapper omsVirtualOrgMemberMapper;

    /**
     * 3-6-02删除虚拟组织成员[2622]
     * gen by moon at 10/16/2022, 7:13:41 AM
     */
    @Trace(operationName = "3-6-02删除虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteVirtualOrgMember(String virtualOrgMemberId) {

        return super.removeById(virtualOrgMemberId);
    }

    /**
     * 3-6-02修改虚拟组织成员[2612]
     * gen by moon at 10/16/2022, 7:13:39 AM
     */
    @Trace(operationName = "3-6-02修改虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateVirtualOrgMember(OmsVirtualOrgMember omsVirtualOrgMember) {
        omsVirtualOrgMember.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsVirtualOrgMember.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        return super.updateById(omsVirtualOrgMember);
    }

    /**
     * 3-6-02批量增虚拟组织成员[2423]
     * gen by moon at 1/2/2023, 3:04:50 AM
     */
    @Trace(operationName = "3-6-02批量增虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddVirtualOrgMember(List<OmsVirtualOrgMember> omsVirtualOrgMember) {

        if (omsVirtualOrgMember == null || omsVirtualOrgMember.size() == 0) {
            return false;
        }

        return super.saveBatch(omsVirtualOrgMember.stream().map(item -> {
            item.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setBatchEndtTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
            item.setIsUpdate("TRUE");
            item.setUpdateStatus("NEW");
            item.setIsEditing("TRUE");
            item.setArchivngType("NOT_ARCHIVE");
            item.setIsArchive("FALSE");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * 3-6-02查虚拟组织成员详情[2379]
     * gen by moon at 8/29/2022, 6:37:20 PM
     */
    @Trace(operationName = "3-6-02查虚拟组织成员详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @BanAuto
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryVirtualOrgMemberDetail(QueryVirtualOrgMemberDetailReq reqDto) {

        try {
            //reqDto.setInductionStartTime();//TIME_SLICE_START_TIME  TODO ruizhe dong
//reqDto.setInductionEndTime();//TIME_SLICE_END_TIME  TODO ruizhe dong
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            if (reqDto.getInductionStartTime() != null && reqDto.getInductionEndTime() != null) {
                queryWrapper.lt("induction_start_time", reqDto.getInductionStartTime());
                queryWrapper.ge("induction_end_time", reqDto.getInductionEndTime());
                reqDto.setInductionStartTime(null);
                reqDto.setInductionEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            System.out.print(e);
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02新增虚拟组织成员[2353]
     * gen by moon at 10/16/2022, 7:13:37 AM
     */
    @Trace(operationName = "3-6-02新增虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addVirtualOrgMember(OmsVirtualOrgMember omsVirtualOrgMember) {
        omsVirtualOrgMember.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsVirtualOrgMember.setInductionEndTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
        omsVirtualOrgMember.setBatchEndtTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
        omsVirtualOrgMember.setIsUpdate("TRUE");
        omsVirtualOrgMember.setUpdateStatus("NEW");
        omsVirtualOrgMember.setIsEditing("TRUE");
        omsVirtualOrgMember.setArchivngType("NOT_ARCHIVE");
        omsVirtualOrgMember.setIsArchive("FALSE");
        omsVirtualOrgMember.setSubjectLifeCycle("EDITING");
        omsVirtualOrgMember.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsVirtualOrgMember.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsVirtualOrgMember.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsVirtualOrgMember.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsVirtualOrgMember.setIsValid("FALSE");
        omsVirtualOrgMember.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsVirtualOrgMember.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsVirtualOrgMember)) {
            return omsVirtualOrgMember.getVirtualOrgMemberId();
        } else {
            return "-1";
        }

    }

    /**
     * 3-6-02批量查内容匹配虚拟成员列表[2232]
     * gen by moon at 8/29/2022, 6:37:18 PM
     */
    @Trace(operationName = "3-6-02批量查内容匹配虚拟成员列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @BanAuto
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryContentVirtualOrgMember(BatchQueryContentVirtualOrgMemberReq reqDto) {
        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            //将内容标识提取出来，要注意 这个地方的in 不是使用主键，要使用同名字段.
            //冗余内容表主键id批量查询
            List<String> ids = reqDto.getVirtualOrgMemberList().stream().map(VirtualOrgMemberDto::getEntityId).collect(Collectors.toList());
            queryWrapper.in("entity_id", ids);

            //正常构建查询条件
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            queryWrapper.orderByDesc("order_number");
            queryWrapper.orderByDesc("operate_time");

            //执行查询
            List<OmsVirtualOrgMember> retListDataTmp = super.list(queryWrapper);
            if (reqDto.getVirtualOrgMemberList() != null && reqDto.getVirtualOrgMemberList().size() > 0) {
                if (reqDto.getVirtualOrgMemberList().get(0).getInductionEndTime() == null) {
                    return retListDataTmp;
                }
            }

            //先构建索引
            Map<String, VirtualOrgMemberDto> indexInfo = new HashMap<>();
            for (VirtualOrgMemberDto oneMember : reqDto.getVirtualOrgMemberList()) {
                indexInfo.put(oneMember.getEntityId(), oneMember);
            }
            //按时间过滤
            Map<String, List<OmsVirtualOrgMember>> retMapByDate = new HashMap<>();
            for (OmsVirtualOrgMember oneData : retListDataTmp) {
                VirtualOrgMemberDto standData = indexInfo.get(oneData.getEntityId());
                if (standData == null) {
                    continue;
                }
                if (standData.getInductionEndTime() == null || standData.getInductionStartTime() == null || oneData.getInductionStartTime() == null || oneData.getInductionEndTime() == null) {
                    continue;
                }
                //此处时间字段，一定是同名字段
                if (standData.getInductionEndTime().compareTo(oneData.getInductionStartTime()) >= 0 && standData.getInductionEndTime().compareTo(oneData.getInductionEndTime()) <= 0) {
                    if (!retMapByDate.containsKey(oneData.getEntityId())) {
                        List<OmsVirtualOrgMember> elmList = new ArrayList<>();
                        elmList.add(oneData);
                        retMapByDate.put(oneData.getEntityId(), elmList);
                    } else {
                        retMapByDate.get(oneData.getEntityId()).add(oneData);
                    }
                }
            }
            //按内容id取最新一条
            List<OmsVirtualOrgMember> retListData = new ArrayList<>();
            for (Map.Entry<String, List<OmsVirtualOrgMember>> oneEntry : retMapByDate.entrySet()) {
                retListData.add(oneEntry.getValue().get(0));
            }

            return retListData;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }

    }

    /**
     * 3-6-02查虚拟组织成员列表[2201]
     * gen by moon at 9/7/2022, 1:40:11 AM
     */
    @Trace(operationName = "3-6-02查虚拟组织成员列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @BanAuto
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> queryVirtualOrgMemberList(QueryVirtualOrgMemberListReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            // TODO: 2024/8/6
            if (reqDto.getInductionStartTime() != null && reqDto.getInductionEndTime() != null) {
                queryWrapper.le("induction_start_time", reqDto.getInductionStartTime());
                queryWrapper.ge("induction_end_time", reqDto.getInductionEndTime());
                reqDto.setInductionStartTime(null);
                reqDto.setInductionEndTime(null);
            }
// TODO: 2024/8/6
            if (reqDto.getCreateTime() != null && reqDto.getReleaseTime() != null) {
                queryWrapper.ge("create_time", reqDto.getCreateTime());
                queryWrapper.le("release_time", reqDto.getReleaseTime());
                reqDto.setCreateTime(null);
                reqDto.setReleaseTime(null);
            }


            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByAsc("order_number");
            queryWrapper.orderByDesc("operate_time");
            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量查虚拟组织成员[2672]
     * gen by moon at 10/16/2022, 7:13:42 AM
     */
    @Trace(operationName = "3-6-02批量查虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryVirtualOrgMember(BatchQueryVirtualOrgMemberReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("entity_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量删虚拟组织成员[2617]
     * gen by moon at 10/16/2022, 7:13:40 AM
     */
    @Trace(operationName = "3-6-02批量删虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchDeleteVirtualOrgMember(List<String> reqDto) {

        if (reqDto == null || reqDto.size() == 0) {
            return false;
        }

        return super.removeByIds(reqDto);
    }

    /**
     * 3-6-02时间切片查询内容匹配虚拟成员[3027]
     * gen by moon at 8/29/2022, 6:37:24 PM
     */
    @Trace(operationName = "3-6-02时间切片查询内容匹配虚拟成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @BanAuto
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> queryByTimeSliceContentVirtualOrgMember(QueryByTimeSliceContentVirtualOrgMemberReq reqDto) {
        try {
//         QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
//         if(reqDto.getundefined()==null || reqDto.getundefined().isEmpty()){
//             return new ArrayList<>();
//         }
//         //将内容标识提取出来，要注意 这个地方的in 不是使用主键，要使用同名字段.
//         List<String> ids = reqDto.getundefined().stream().map(undefined::getEntityId).collect(Collectors.toList());
//         queryWrapper.in("entity_id", ids);
//
//         //正常构建查询条件
//         Map<String, Object> fieldInfoMap = null;
//         fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
//         List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
//         CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
//         List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
//         CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
//         likeList.addAll(compareList);
//         CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
//         queryWrapper.orderByDesc("order_number");
//         queryWrapper.orderByDesc("operate_time");
//
//         //执行查询
//         List<OmsVirtualOrgMember> retListDataTmp = super.list(queryWrapper);
//
//
//         //先构建索引
//         Map<String,undefined> indexInfo = new HashMap<>();
//         for(undefined oneMember : reqDto.getundefined()){
//             indexInfo.put(oneMember.getEntityId(),oneMember);
//         }
//         //按时间过滤
//         Map<String,List<OmsVirtualOrgMember>> retMapByDate = new HashMap<>();
//         for(OmsVirtualOrgMember oneData: retListDataTmp){
//             undefined standData = indexInfo.get(oneData);
//             //此处时间字段，一定是同名字段
//             if(oneData.getInductionStartTime().compareTo(standData.getInductionStartTime())>=0 && oneData.getInductionEndTime().compareTo(standData.getInductionEndTime())<0){
//                 if(!retMapByDate.containsKey(oneData.getEntityId())){
//                     List<OmsVirtualOrgMember> elmList= new ArrayList<>();
//                     elmList.add(oneData);
//                     retMapByDate.put(oneData.getEntityId(),elmList);
//                 }else{
//                     retMapByDate.get(oneData.getEntityId()).add(oneData);
//                 }
//             }
//         }
//         //按内容id取最新一条
//         List<OmsVirtualOrgMember> retListData = new ArrayList<>();
//         for(Map.Entry<String,List<OmsVirtualOrgMember>> oneEntry : retMapByDate.entrySet()){
//             retListData.add(oneEntry.getValue().get(0));
//         }

            return new ArrayList<>();
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }

    }

    /**
     * 3-6-02时间切片查询内容匹配虚拟成员列表[3012]
     * gen by moon at 8/29/2022, 6:37:23 PM
     */
    @Trace(operationName = "3-6-02时间切片查询内容匹配虚拟成员列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @BanAuto
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> queryListByTimeSliceContentVirtualOrgMember(QueryListByTimeSliceContentVirtualOrgMemberReq reqDto) {
        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            //将内容标识提取出来，要注意 这个地方的in 不是使用主键，要使用同名字段.
            List<String> ids = reqDto.getVirtualOrgMemberList().stream().map(VirtualOrgMemberDto::getVirtualOrgId).collect(Collectors.toList());
            queryWrapper.in("virtual_org_id", ids);

            //正常构建查询条件
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
//         queryWrapper.orderByDesc("order_number");
            queryWrapper.orderByDesc("operate_time");

            //执行查询
            List<OmsVirtualOrgMember> retListDataTmp = super.list(queryWrapper);

            //虚拟组织成员列数据集大于0，且 第一条的就职开始时间为空，直接返回（与代码生成无关，纯手写逻辑）
            if (reqDto.getVirtualOrgMemberList() != null && reqDto.getVirtualOrgMemberList().size() > 0) {
                if (reqDto.getVirtualOrgMemberList().get(0).getInductionEndTime() == null) {
                    return retListDataTmp;
                }
            }

            //先构建索引，从入参虚拟组织id，构建索引，key是虚拟组织id,value是入参的三个字段
            Map<String, VirtualOrgMemberDto> indexInfo = new HashMap<>();
            for (VirtualOrgMemberDto oneMember : reqDto.getVirtualOrgMemberList()) {
                indexInfo.put(oneMember.getVirtualOrgId(), oneMember);
            }
            //按时间过滤(手写的)
            Map<String, List<OmsVirtualOrgMember>> retMapByDate = new HashMap<>();
            //用批量查询的出参结果循环发牌
            for (OmsVirtualOrgMember oneData : retListDataTmp) {
                //从牌里面找到对应的入参对象，基于虚拟组织id
                VirtualOrgMemberDto standData = indexInfo.get(oneData.getVirtualOrgId());
                //此处时间字段，一定是同名字段
                //入参就职结束时间大于等于牌的就职开始时间且入参就职结束时间小于等于牌的就职结束时间
                if (standData.getInductionEndTime().compareTo(oneData.getInductionStartTime()) >= 0 && standData.getInductionEndTime().compareTo(oneData.getInductionEndTime()) <= 0) {
                    if (!retMapByDate.containsKey(oneData.getEntityId())) {
                        // TODO: 2025/3/22 此处可能无序
                        List<OmsVirtualOrgMember> elmList = new ArrayList<>();
                        elmList.add(oneData);
                        retMapByDate.put(oneData.getEntityId(), elmList);
                    } else {
                        retMapByDate.get(oneData.getEntityId()).add(oneData);
                    }
                }
            }
            //按内容id取最新一条
            List<OmsVirtualOrgMember> retListData = new ArrayList<>();
            //分组后取第一条，有可能因为上面数据集问题，产生错误
            for (Map.Entry<String, List<OmsVirtualOrgMember>> oneEntry : retMapByDate.entrySet()) {
                retListData.add(oneEntry.getValue().get(0));
            }

            return retListData;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }

    }

    /**
     * 3-6-02批量修改虚拟组织成员[3316]
     * gen by moon at 10/16/2022, 7:13:43 AM
     */
    @Trace(operationName = "3-6-02批量修改虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchUpdateVirtualOrgMember(List<OmsVirtualOrgMember> omsVirtualOrgMember) {

        if (omsVirtualOrgMember == null || omsVirtualOrgMember.size() == 0) {
            return false;
        }
        omsVirtualOrgMember = omsVirtualOrgMember.stream().map(item -> {
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("ARCHIVING")) {
                item.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());
            }
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());
            }
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseTime(CommonFunctionHelper.getCurrentTime());
            }
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("ARCHIVING")) {
                item.setArchiveTime(CommonFunctionHelper.getCurrentTime());
            }
            return item;
        }).collect(Collectors.toList());

        return super.saveOrUpdateBatch(omsVirtualOrgMember);

    }

    /**
     * 3-6-02构造虚拟组织成员验证数据[4245]
     * gen by moon at 10/16/2022, 7:13:44 AM
     */
    @Trace(operationName = "3-6-02构造虚拟组织成员验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String buildVirtualOrgMem(OmsVirtualOrgMember omsVirtualOrgMember) {
        omsVirtualOrgMember.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsVirtualOrgMember.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsVirtualOrgMember.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsVirtualOrgMember.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
        }
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsVirtualOrgMember.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//ARCHIVE_CURRENT_INDUCTIONID
        }
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsVirtualOrgMember.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
        }
        omsVirtualOrgMember.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsVirtualOrgMember.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsVirtualOrgMember.setArchiveTime(CommonFunctionHelper.getCurrentTime());//HISTORICAL_ARCHIVING
        }
        omsVirtualOrgMember.setIsValid("FALSE");
        omsVirtualOrgMember.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsVirtualOrgMember.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsVirtualOrgMember)) {
            return omsVirtualOrgMember.getVirtualOrgMemberId();
        } else {
            return "-1";
        }

    }

    /**
     * M3-6-02构造单条虚拟组织成员验证数据[4275]
     * gen by moon at 10/16/2022, 7:13:44 AM
     */
    @Trace(operationName = "M3-6-02构造单条虚拟组织成员验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String buildSingleVirtualOrgMem(OmsVirtualOrgMember omsVirtualOrgMember) {
        omsVirtualOrgMember.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsVirtualOrgMember.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsVirtualOrgMember.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsVirtualOrgMember.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
        }
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsVirtualOrgMember.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//ARCHIVE_CURRENT_INDUCTIONID
        }
        omsVirtualOrgMember.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsVirtualOrgMember.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsVirtualOrgMember.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
        }
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsVirtualOrgMember.setArchiveTime(CommonFunctionHelper.getCurrentTime());//HISTORICAL_ARCHIVING
        }
        omsVirtualOrgMember.setIsValid("FALSE");
        omsVirtualOrgMember.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsVirtualOrgMember.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsVirtualOrgMember)) {
            return omsVirtualOrgMember.getVirtualOrgMemberId();
        } else {
            return "-1";
        }

    }

    /**
     * M3-6-02批量增虚拟组织成员[4357]
     * gen by moon at 10/16/2022, 7:13:45 AM
     */
    @Trace(operationName = "M3-6-02批量增虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddVirtualOrgMem(List<OmsVirtualOrgMember> omsVirtualOrgMember) {

        if (omsVirtualOrgMember == null || omsVirtualOrgMember.size() == 0) {
            return false;
        }

        return super.saveBatch(omsVirtualOrgMember.stream().map(item -> {
            item.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setIsArchive("FALSE");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
            }
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
            }
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * M3-6-02查询虚拟组织成员列表[4360]
     * gen by moon at 10/16/2022, 7:13:46 AM
     */
    @Trace(operationName = "M3-6-02查询虚拟组织成员列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> queryVirtualOrgMemList(QueryVirtualOrgMemListReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3-6-02查询虚拟组织成员详情[4361]
     * gen by moon at 3/30/2023, 12:38:53 PM
     */
    @Trace(operationName = "M3-6-02查询虚拟组织成员详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryVirtualOrgMemDetail(QueryVirtualOrgMemDetailReq reqDto) {

        try {
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3-6-02一键删除多个单条虚拟组织成员验证数据[4420]
     * gen by moon at 10/16/2022, 7:13:48 AM
     */
    @Trace(operationName = "M3-6-02一键删除多个单条虚拟组织成员验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean autoDeleteSingleVirtualOrgMem(List<String> reqDto) {

        if (reqDto == null || reqDto.size() == 0) {
            return false;
        }

        return super.removeByIds(reqDto);
    }

    /**
     * M3-6-02查询单条虚拟组织成员列表[4450]
     * gen by moon at 4/6/2023, 12:15:57 AM
     */
    @Trace(operationName = "M3-6-02查询单条虚拟组织成员列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> querySingleVirtualOrgMemList(QuerySingleVirtualOrgMemListReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3-6-02删除单条虚拟组织成员[4528]
     * gen by moon at 10/16/2022, 7:13:50 AM
     */
    @Trace(operationName = "M3-6-02删除单条虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteSingleVirtualOrgMem(String virtualOrgMemberId) {

        return super.removeById(virtualOrgMemberId);
    }

    /**
     * 3-6-02批量查询角色标识匹配虚拟组织成员[5476]
     * gen by moon at 10/16/2023, 7:21:49 AM
     */
    @Trace(operationName = "3-6-02批量查询角色标识匹配虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryRoleCodeVirtualOrgMember(BatchQueryRoleCodeVirtualOrgMemberReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            if (reqDto.getRoleCodeVirtualOrgMemberList() == null || reqDto.getRoleCodeVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("role_code", reqDto.getRoleCodeVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3查询虚拟组织成员测试详情[6223]
     * gen by moon at 4/5/2023, 11:50:21 AM
     */
    @Trace(operationName = "M3查询虚拟组织成员测试详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryVirtualOrgMemTestDataDetail(QueryVirtualOrgMemTestDataDetailReq reqDto) {

        try {
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3查圈子成员基本信息详情[7326]
     * gen by moon at 8/1/2023, 9:20:46 PM
     */
    @Trace(operationName = "M3查圈子成员基本信息详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryCircleMemberInfoDetail(QueryCircleMemberInfoDetailReq reqDto) {

        try {

            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量查询虚拟组织成员列表ByIds[7347]
     * gen by moon at 8/5/2023, 8:24:18 PM
     */
    @Trace(operationName = "3-6-02批量查询虚拟组织成员列表ByIds")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryVirtualOrgMemberListByIds(BatchQueryVirtualOrgMemberListByIdsReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();

            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("original_role_member_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3批量查询虚拟组织成员测试列表ByIds[6225]
     * gen by moon at 10/31/2023, 11:36:54 PM
     */
    @Trace(operationName = "M3批量查询虚拟组织成员测试列表ByIds")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryVirtualOrgMemTestDataListByIds(BatchQueryVirtualOrgMemTestDataListByIdsReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();

            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("entity_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02新增无批次虚拟组织成员[7820]
     * gen by moon at 11/14/2023, 6:24:45 PM
     */
    @Trace(operationName = "3-6-02新增无批次虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addNoBatchVirtualOrgMember(OmsVirtualOrgMember omsVirtualOrgMember) {
        omsVirtualOrgMember.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsVirtualOrgMember.setIsArchive("FALSE");
        omsVirtualOrgMember.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsVirtualOrgMember.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsVirtualOrgMember.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
        }
        if (omsVirtualOrgMember != null && omsVirtualOrgMember.getSubjectLifeCycle() != null && omsVirtualOrgMember.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsVirtualOrgMember.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
        }
        omsVirtualOrgMember.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsVirtualOrgMember.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsVirtualOrgMember.setIsValid("FALSE");
        omsVirtualOrgMember.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsVirtualOrgMember.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsVirtualOrgMember)) {
            return omsVirtualOrgMember.getVirtualOrgMemberId();
        } else {
            return "-1";
        }

    }

    /**
     * 3-6-02批量查询虚拟成员By归属对象[7873]
     * gen by moon at 11/11/2023, 1:52:29 AM
     */
    @Trace(operationName = "3-6-02批量查询虚拟成员By归属对象")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryVirtualOrgMemberByOwnershipObject(BatchQueryVirtualOrgMemberByOwnershipObjectReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("evaluation_template_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量查询虚拟成员By账号[7890]
     * gen by moon at 11/11/2023, 1:52:32 AM
     */
    @Trace(operationName = "3-6-02批量查询虚拟成员By账号")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryVirtualOrgMemberByUserId(BatchQueryVirtualOrgMemberByUserIdReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("user_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02执行主键ID批量查虚拟组织成员[8026]
     * gen by moon at 11/28/2023, 11:37:41 AM
     */
    @Trace(operationName = "3-6-02执行主键ID批量查虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> implementPrimaryKeyBatchQueryVirtualOrgMember(ImplementPrimaryKeyBatchQueryVirtualOrgMemberReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("virtual_org_member_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02执行就职记录批量查虚拟组织成员[8051]
     * gen by moon at 12/2/2023, 12:16:43 AM
     */
    @Trace(operationName = "3-6-02执行就职记录批量查虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> implementInductionBatchQueryVirtualOrgMember(ImplementInductionBatchQueryVirtualOrgMemberReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("virtual_org_induction_record_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02查询消息发送虚拟组织成员详情[8217]
     * gen by moon at 12/28/2023, 6:46:18 AM
     */
    @Trace(operationName = "3-6-02查询消息发送虚拟组织成员详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryMsgSendVirtualOrgMemberDetail(QueryMsgSendVirtualOrgMemberDetailReq reqDto) {

        try {
            reqDto.setIsValid("FALSE");
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量增无批次虚拟组织成员[8334]
     * gen by moon at 1/24/2024, 7:15:21 PM
     */
    @Trace(operationName = "3-6-02批量增无批次虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddNoBatchVirtualOrgMember(List<OmsVirtualOrgMember> omsVirtualOrgMember) {

        if (omsVirtualOrgMember == null || omsVirtualOrgMember.size() == 0) {
            return false;
        }

        return super.saveBatch(omsVirtualOrgMember.stream().map(item -> {
            item.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setIsArchive("FALSE");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
            }
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
            }
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * 3-6-02查询消息发送虚拟组织成员列表[8224]
     * gen by moon at 1/25/2024, 2:46:11 AM
     */
    @Trace(operationName = "3-6-02查询消息发送虚拟组织成员列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> queryMsgSendVirtualOrgMemberList(QueryMsgSendVirtualOrgMemberListReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量增有批次虚拟组织成员[8348]
     * gen by moon at 1/25/2024, 4:55:44 PM
     */
    @Trace(operationName = "3-6-02批量增有批次虚拟组织成员")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddBatchVirtualOrgMember(List<OmsVirtualOrgMember> omsVirtualOrgMember) {

        if (omsVirtualOrgMember == null || omsVirtualOrgMember.size() == 0) {
            return false;
        }

        return super.saveBatch(omsVirtualOrgMember.stream().map(item -> {
            item.setVirtualOrgMemberId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setArchivngType("NOT_ARCHIVE");
            item.setIsArchive("FALSE");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
            }
            if (item != null && item.getSubjectLifeCycle() != null && item.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
                item.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
            }
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * 3-6-02批量查询虚拟组织成员By就职记录[8874]
     * gen by moon at 3/29/2024, 8:31:33 PM
     */
    @Trace(operationName = "3-6-02批量查询虚拟组织成员By就职记录")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQueryVirtualOrgMemberByinducRecId(BatchQueryVirtualOrgMemberByinducRecIdReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("virtual_org_induction_record_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02批量查询小圈子By内容[9057]
     * gen by moon at 4/2/2024, 6:12:42 PM
     */
    @Trace(operationName = "3-6-02批量查询小圈子By内容")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsVirtualOrgMember> batchQuerySmallCircleByEntityId(BatchQuerySmallCircleByEntityIdReq reqDto) {

        try {
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();

            if (reqDto.getVirtualOrgMemberList() == null || reqDto.getVirtualOrgMemberList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("entity_id", reqDto.getVirtualOrgMemberList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsVirtualOrgMember.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsVirtualOrgMember>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02查询目标内容责任人小圈子详情[9250]
     * gen by moon at 4/4/2024, 10:02:29 AM
     */
    @Trace(operationName = "3-6-02查询目标内容责任人小圈子详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryTargetContInitiatorSmallCircleDetail(QueryTargetContInitiatorSmallCircleDetailReq reqDto) {

        try {

            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02查询目标内容成员小圈子详情[9250]
     * gen by moon at 4/7/2024, 8:48:40 AM
     */
    @Trace(operationName = "3-6-02查询目标内容成员小圈子详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryTargetContMemberSmallCircleDetail(QueryTargetContMemberSmallCircleDetailReq reqDto) {

        try {

            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsVirtualOrgMember> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsVirtualOrgMember retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-6-02时间切片查虚拟组织成员详情[10518]
     * gen by moon at 4/5/2025, 12:52:30 PM
     */
    @Trace(operationName = "3-6-02时间切片查虚拟组织成员详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsVirtualOrgMember queryByTimeSliceVirtualOrgMemberDetail(QueryByTimeSliceVirtualOrgMemberDetailReq reqDto) {
        try {
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());
            Date targetTime = reqDto.getInductionEndTime();
            reqDto.setInductionEndTime(null);
            QueryWrapper<OmsVirtualOrgMember> queryWrapper = new QueryWrapper<>();
            //正常构建查询条件
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsVirtualOrgMember.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            queryWrapper.orderByDesc("operate_time");

            //执行查询
            List<OmsVirtualOrgMember> retListDataTmp = super.list(queryWrapper);

            for (OmsVirtualOrgMember oneData : retListDataTmp) {
                //此处时间字段，一定是同名字段
                if (targetTime.compareTo(oneData.getInductionStartTime()) >= 0 && targetTime.compareTo(oneData.getInductionEndTime()) < 0) {
                    return oneData;
                }
            }

            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }

    }
}
